<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>我的预约记录</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f0f5f9;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            min-height: 100vh;
            margin: 0;
            padding: 0;
        }
        nav {
            background-color: #3498db;
            width: 100%;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 20px;
        }
        nav a {
            color: white;
            text-decoration: none;
            padding: 10px 15px;
            margin-right: 20px;
        }
        nav a:hover {
            background-color: #2980b9;
            border-radius: 5px;
        }
        h2 {
            color: #2980b9;
            margin-bottom: 30px;
            font-size: 2em;
        }
        table {
            width: 100%;
            max-width: none;
            border-collapse: collapse;
            background-color: #fff;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
            border-radius: 10px;
            overflow: hidden;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 15px 20px;
            text-align: left;
        }
        th {
            background-color: #3498db;
            color: white;
            font-weight: bold;
            text-transform: uppercase;
        }
        tr:nth-child(even) {
            background-color: #ecf0f1;
        }
        tr:hover {
            background-color: #d5e7f2;
            transition: background-color 0.3s ease;
        }
        .table-container {
            padding: 30px;
            border-radius: 10px;
            background-color: #fff;
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
            width: 90%;
            max-width: 1200px;
        }
        .table-container:hover {
            box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
            transition: box-shadow 0.3s ease;
        }
        .button-container {
            display: flex;
            justify-content: center;
            margin-top: 20px;
        }
        .button-container button {
            padding: 10px 20px;
            margin: 0 10px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            background-color: #2ecc71;
            color: white;
            font-size: 1em;
        }
        .button-container button:hover {
            background-color: #27ae60;
            transition: background-color 0.3s ease;
        }
    </style>
</head>
<body>
<nav>
    <a href="${pageContext.request.contextPath}/classroomList">返回首页</a>
</nav>
<div class="table-container">
    <h2>我的预约记录</h2>
    <table>
        <tr>
            <th>预约记录 ID</th>
            <th>教室 ID</th>
            <th>开始时间</th>
            <th>结束时间</th>
            <th>状态</th>
        </tr>
        <c:forEach var="reservation" items="${reservationsList}">
            <tr>
                <td>${reservation.reservationId}</td>
                <td>${reservation.classroom.classroomId}</td>
                <td><fmt:formatDate value="${reservation.startDatetime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                <td><fmt:formatDate value="${reservation.endDatetime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
                <td>${reservation.status}</td>
            </tr>
        </c:forEach>
    </table>
    <div class="button-container">
        <button onclick="location.reload()">刷新</button>
        <button onclick="window.print()">打印</button>
    </div>
</div>
</body>
</html>